#light
open System
open Schema
open Document

(*type WriteOp = Index of Document | Batch of Document list | Schema of IndexSchema | Optimize  
let rec write op = 
    match op with
    | Index(doc) -> 
        convert doc
    | Schema(s) -> printfn "Saving schema: %s" s.Name
    | Optimize -> printfn "Optimizing"
    | Batch(h::t) -> 
        write (Index h)
        printfn "%d remaining in batch" t.Length
        write (Batch t)        
    | Batch([]) -> printfn "Done!"*)
    
(*let doc () : Document = 
    { 
        Schema = defaultSchema; 
        Fields = 
            [
                ( "ID", Guid.NewGuid().ToString() );
                ( "Title", "Some Content" );
                ( "PublishDate", DateTime.Now.ToString() );
                ( "Excerpt", "Some excerpt" );
                ( "Body", "A body of text!" )
            ]
    }*)

(*let batch = Batch ([1..10] |> List.map (fun x -> doc ())) *)

(*write batch

write Optimize*)

sampleDoc |> convert |> printfn "%A"